package com.dongdongshop.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.LogAspect;
import com.dongdongshop.mapper.TbBrandMapper;
import com.dongdongshop.pojo.TbBrand;
import com.dongdongshop.service.BrandService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description
 * @ClassName BrandServiceImpl
 * @Author RC
 * @date 2020.12.09 19:49
 */
@Component
@Service
public class BrandServiceImpl implements BrandService {
    @Resource
    private TbBrandMapper tbBrandMapper;
    private static final Logger logger = LoggerFactory.getLogger(BrandServiceImpl.class);

    @Override
    public List<TbBrand> brandList( ) {
        return tbBrandMapper.selectByExample(null);
    }

    @Override
    public boolean saveBrand(TbBrand tbBrand) {
        int i = tbBrandMapper.insertSelective(tbBrand);
        return i > 0;
    }

    @Override
    public TbBrand getBrandById(Integer id) {
        return tbBrandMapper.selectByPrimaryKey(id.longValue());
    }

    @Override
    public boolean updateBrand(TbBrand tbBrand) {
        int i = tbBrandMapper.updateByPrimaryKeySelective(tbBrand);
        return i > 0;

    }

    @Override
    public boolean deleteBatchBrand(Integer[] ids) {
        int i = tbBrandMapper.deleteBatchBrand(ids);
        return i > 0;
    }
}
